﻿<%@ Page Language="C#" MasterPageFile="../main.master" Inherits="VioletDevelopmentLaboratory.Net.Web.Configuration.VWebConfigManagerPage" %>
<%@ Import Namespace="System.Web.Configuration" %>

<script runat="server">
	protected void CacheDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}

	
	
	
	protected void OutputCacheDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}





	protected void OutputCacheProfilesGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
	{
		OutputCacheProfilesDetailsView.ChangeMode(DetailsViewMode.ReadOnly);
	}

	protected void OutputCacheProfilesDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
	{
		ShowAlert_DetailsView_ItemInserted(e);

		OutputCacheProfilesGridView.SelectedIndex = -1;
		OutputCacheProfilesGridView.DataBind();
	}

	protected void OutputCacheProfilesDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);

		OutputCacheProfilesGridView.SelectedIndex = -1;
		OutputCacheProfilesGridView.DataBind();
	}

	protected void OutputCacheProfilesDetailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
	{
		ShowAlert_DetailsView_ItemDeleted(e);

		OutputCacheProfilesDetailsView.ChangeMode(DetailsViewMode.Insert);
		
		OutputCacheProfilesGridView.SelectedIndex = -1;
		OutputCacheProfilesGridView.DataBind();
	}




	protected void SqlCacheDependencyDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}





	protected void DatabasesGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
	{
		DatabasesDetailsView.ChangeMode(DetailsViewMode.ReadOnly);
	}

	protected void DatabasesDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
	{
		ShowAlert_DetailsView_ItemInserted(e);

		DatabasesGridView.SelectedIndex = -1;
		DatabasesGridView.DataBind();
	}

	protected void DatabasesDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);

		DatabasesGridView.SelectedIndex = -1;
		DatabasesGridView.DataBind();
	}

	protected void DatabasesDetailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
	{
		ShowAlert_DetailsView_ItemDeleted(e);

		DatabasesDetailsView.ChangeMode(DetailsViewMode.Insert);
		
		DatabasesGridView.SelectedIndex = -1;
		DatabasesGridView.DataBind();
	}
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPlaceHolder" runat="server">

	<h2>Caching</h2>

	<div>
		<asp:ObjectDataSource ID="CacheDetailsViewDataSource" runat="server" 
			SelectMethod="GetCacheSection" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.CachingCacheSectionManager" 
			UpdateMethod="Modify">
			<UpdateParameters>
				<asp:Parameter Name="disableMemoryCollection" Type="Boolean" />
				<asp:Parameter Name="disableExpiration" Type="Boolean" />
				<asp:Parameter Name="privateBytesLimit" Type="Int64" />
				<asp:Parameter Name="percentagePhysicalMemoryUsedLimit" Type="Int32" />
				<asp:Parameter Name="privateBytesPollTime" Type="Object" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>cache</legend>
			<asp:DetailsView ID="CacheDetailsView" runat="server" CellPadding="5" 
							AutoGenerateRows="False" DataSourceID="CacheDetailsViewDataSource" 
							DefaultMode="Edit" onitemupdated="CacheDetailsView_ItemUpdated">
				<Fields>
					<asp:CheckBoxField DataField="DisableMemoryCollection" 
						HeaderText="DisableMemoryCollection" SortExpression="DisableMemoryCollection" />
					<asp:CheckBoxField DataField="DisableExpiration" HeaderText="DisableExpiration" 
						SortExpression="DisableExpiration" />
					<asp:BoundField DataField="PrivateBytesLimit" HeaderText="PrivateBytesLimit" 
						SortExpression="PrivateBytesLimit" />
					<asp:BoundField DataField="PercentagePhysicalMemoryUsedLimit" 
						HeaderText="PercentagePhysicalMemoryUsedLimit" 
						SortExpression="PercentagePhysicalMemoryUsedLimit" />
					<asp:BoundField DataField="PrivateBytesPollTime" 
						HeaderText="PrivateBytesPollTime" SortExpression="PrivateBytesPollTime" />
					<asp:CommandField ButtonType="Button" ShowEditButton="True" 
						ShowCancelButton="False" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>

	<div>
		<asp:ObjectDataSource ID="OutputCacheDetailsViewDataSource" runat="server" 
			SelectMethod="GetOutputCacheSection" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.CachingOutputCacheSectionManager" 
			UpdateMethod="Modify">
			<UpdateParameters>
				<asp:Parameter Name="enableOutputCache" Type="Boolean" />
				<asp:Parameter Name="enableFragmentCache" Type="Boolean" />
				<asp:Parameter Name="sendCacheControlHeader" Type="Boolean" />
				<asp:Parameter Name="omitVaryStar" Type="Boolean" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>outputCache</legend>
			<asp:DetailsView ID="OutputCacheDetailsView" runat="server" CellPadding="5" 
							AutoGenerateRows="False" DataSourceID="OutputCacheDetailsViewDataSource" 
							DefaultMode="Edit" onitemupdated="OutputCacheDetailsView_ItemUpdated">
				<Fields>
					<asp:CheckBoxField DataField="EnableOutputCache" HeaderText="EnableOutputCache" 
						SortExpression="EnableOutputCache" />
					<asp:CheckBoxField DataField="EnableFragmentCache" 
						HeaderText="EnableFragmentCache" SortExpression="EnableFragmentCache" />
					<asp:CheckBoxField DataField="SendCacheControlHeader" 
						HeaderText="SendCacheControlHeader" SortExpression="SendCacheControlHeader" />
					<asp:CheckBoxField DataField="OmitVaryStar" HeaderText="OmitVaryStar" 
						SortExpression="OmitVaryStar" />
					<asp:CommandField ButtonType="Button" ShowEditButton="True" 
						ShowCancelButton="False" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>

	<div>
		<asp:ObjectDataSource ID="OutputCacheProfilesDetailsViewDataSource" 
			runat="server" 
			DeleteMethod="RemoveOutputCacheProfile" InsertMethod="AddOutputCacheProfile" 
			SelectMethod="GetOutputCacheProfile" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.CachingOutputCacheSettingsSectionManager" 
			UpdateMethod="ModifyOutputCacheProfile">
			<DeleteParameters>
				<asp:Parameter Name="name" Type="String" />
			</DeleteParameters>
			<UpdateParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="enabled" Type="Boolean" />
				<asp:Parameter Name="duration" Type="Int32" />
				<asp:Parameter Name="location" Type="Object" />
				<asp:Parameter Name="sqlDependency" Type="String" />
				<asp:Parameter Name="varyByCustom" Type="String" />
				<asp:Parameter Name="varyByControl" Type="String" />
				<asp:Parameter Name="varyByHeader" Type="String" />
				<asp:Parameter Name="varyByParam" Type="String" />
				<asp:Parameter Name="noStore" Type="Boolean" />
			</UpdateParameters>
			<SelectParameters>
				<asp:ControlParameter ControlID="OutputCacheProfilesGridView" Name="name" 
					PropertyName="SelectedValue" Type="String" />
			</SelectParameters>
			<InsertParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="enabled" Type="Boolean" />
				<asp:Parameter Name="duration" Type="Int32" />
				<asp:Parameter Name="location" Type="Object" />
				<asp:Parameter Name="sqlDependency" Type="String" />
				<asp:Parameter Name="varyByCustom" Type="String" />
				<asp:Parameter Name="varyByControl" Type="String" />
				<asp:Parameter Name="varyByHeader" Type="String" />
				<asp:Parameter Name="varyByParam" Type="String" />
				<asp:Parameter Name="noStore" Type="Boolean" />
			</InsertParameters>
		</asp:ObjectDataSource>
		<asp:ObjectDataSource ID="OutputCacheProfilesGridViewDataSource" runat="server" 
			SelectMethod="GetOutputCacheProfileCollection" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.CachingOutputCacheSettingsSectionManager"></asp:ObjectDataSource>
		<fieldset>
			<legend>outputCacheSettings/outputCacheProfiles</legend>
			<asp:DetailsView ID="OutputCacheProfilesDetailsView" runat="server" CellPadding="5" 
							AutoGenerateRows="False" DataKeyNames="Name" 
							DataSourceID="OutputCacheProfilesDetailsViewDataSource" DefaultMode="Insert" 
							oniteminserted="OutputCacheProfilesDetailsView_ItemInserted" 
							onitemupdated="OutputCacheProfilesDetailsView_ItemUpdated" 
							onitemdeleted="OutputCacheProfilesDetailsView_ItemDeleted">
				<Fields>
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
					<asp:CheckBoxField DataField="Enabled" HeaderText="Enabled" 
						SortExpression="Enabled" />
					<asp:BoundField DataField="Duration" HeaderText="Duration" 
						SortExpression="Duration" />
					<asp:BoundField DataField="SqlDependency" HeaderText="SqlDependency" 
						SortExpression="SqlDependency" />
					<asp:BoundField DataField="VaryByCustom" HeaderText="VaryByCustom" 
						SortExpression="VaryByCustom" />
					<asp:BoundField DataField="VaryByControl" HeaderText="VaryByControl" 
						SortExpression="VaryByControl" />
					<asp:BoundField DataField="VaryByHeader" HeaderText="VaryByHeader" 
						SortExpression="VaryByHeader" />
					<asp:BoundField DataField="VaryByParam" HeaderText="VaryByParam" 
						SortExpression="VaryByParam" />
					<asp:CheckBoxField DataField="NoStore" HeaderText="NoStore" 
						SortExpression="NoStore" />
					<asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
						ShowEditButton="True" ShowInsertButton="True" />
				</Fields>
			</asp:DetailsView>
			<asp:GridView ID="OutputCacheProfilesGridView" runat="server" CellPadding="5" 
							AutoGenerateColumns="False" DataKeyNames="Name" 
							DataSourceID="OutputCacheProfilesGridViewDataSource" 
							onselectedindexchanging="OutputCacheProfilesGridView_SelectedIndexChanging">
				<Columns>
					<asp:CommandField ShowSelectButton="True" />
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
					<asp:CheckBoxField DataField="Enabled" HeaderText="Enabled" 
						SortExpression="Enabled" />
					<asp:BoundField DataField="Duration" HeaderText="Duration" 
						SortExpression="Duration" />
					<asp:BoundField DataField="SqlDependency" HeaderText="SqlDependency" 
						SortExpression="SqlDependency" />
					<asp:BoundField DataField="VaryByCustom" HeaderText="VaryByCustom" 
						SortExpression="VaryByCustom" />
					<asp:BoundField DataField="VaryByControl" HeaderText="VaryByControl" 
						SortExpression="VaryByControl" />
					<asp:BoundField DataField="VaryByHeader" HeaderText="VaryByHeader" 
						SortExpression="VaryByHeader" />
					<asp:BoundField DataField="VaryByParam" HeaderText="VaryByParam" 
						SortExpression="VaryByParam" />
					<asp:CheckBoxField DataField="NoStore" HeaderText="NoStore" 
						SortExpression="NoStore" />
				</Columns>
				<SelectedRowStyle BackColor="SkyBlue" />
			</asp:GridView>
		</fieldset>
	</div>

	<div>
		<asp:ObjectDataSource ID="SqlCacheDependencyDetailsViewDataSource" 
			runat="server" SelectMethod="GetSqlCacheDependencySection" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.CachingSqlCacheDependencySectionManager" 
			UpdateMethod="Modify">
			<UpdateParameters>
				<asp:Parameter Name="enabled" Type="Boolean" />
				<asp:Parameter Name="pollTime" Type="Int32" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>sqlCacheDependency</legend>
			<asp:DetailsView ID="SqlCacheDependencyDetailsView" runat="server" 
				CellPadding="5" AutoGenerateRows="False" 
				DataSourceID="SqlCacheDependencyDetailsViewDataSource" DefaultMode="Edit" 
							onitemupdated="SqlCacheDependencyDetailsView_ItemUpdated">
				<Fields>
					<asp:CheckBoxField DataField="Enabled" HeaderText="Enabled" 
						SortExpression="Enabled" />
					<asp:BoundField DataField="PollTime" HeaderText="PollTime" 
						SortExpression="PollTime" />
					<asp:CommandField ButtonType="Button" ShowCancelButton="False" 
						ShowEditButton="True" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>

	<div style="margin-left : 30px">
		<asp:ObjectDataSource ID="DatabasesDetailsViewDataSource" runat="server" 
			DeleteMethod="RemoveDataBase" InsertMethod="AddDataBase" 
			SelectMethod="GetSqlCacheDependencyDatabase" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.CachingSqlCacheDependencySectionManager" 
			UpdateMethod="ModifyDataBase">
			<DeleteParameters>
				<asp:Parameter Name="name" Type="String" />
			</DeleteParameters>
			<UpdateParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="connectionStringName" Type="String" />
				<asp:Parameter Name="pollTime" Type="Int32" />
			</UpdateParameters>
			<SelectParameters>
				<asp:ControlParameter ControlID="DatabasesGridView" Name="name" 
					PropertyName="SelectedValue" Type="String" />
			</SelectParameters>
			<InsertParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="connectionStringName" Type="String" />
				<asp:Parameter Name="pollTime" Type="Int32" />
			</InsertParameters>
		</asp:ObjectDataSource>
		<asp:ObjectDataSource ID="DatabasesGridViewDataSource" runat="server" 
			SelectMethod="GetSqlCacheDependencyDatabaseCollection" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.CachingSqlCacheDependencySectionManager"></asp:ObjectDataSource>
		<fieldset>
			<legend>databases</legend>
			<asp:DetailsView ID="DatabasesDetailsView" runat="server" CellPadding="5" 
				AutoGenerateRows="False" DataSourceID="DatabasesDetailsViewDataSource" 
				DefaultMode="Insert" oniteminserted="DatabasesDetailsView_ItemInserted" 
				onitemupdated="DatabasesDetailsView_ItemUpdated" 
				onitemdeleted="DatabasesDetailsView_ItemDeleted" DataKeyNames="Name">
				<Fields>
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
					<asp:BoundField DataField="ConnectionStringName" 
						HeaderText="ConnectionStringName" SortExpression="ConnectionStringName" />
					<asp:BoundField DataField="PollTime" HeaderText="PollTime" 
						SortExpression="PollTime" />
					<asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
						ShowEditButton="True" ShowInsertButton="True" />
				</Fields>
			</asp:DetailsView>
			<asp:GridView ID="DatabasesGridView" runat="server" AutoGenerateColumns="False" 
				CellPadding="5" DataKeyNames="Name" DataSourceID="DatabasesGridViewDataSource" 
				onselectedindexchanging="DatabasesGridView_SelectedIndexChanging">
				<Columns>
					<asp:CommandField ShowSelectButton="True" />
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
					<asp:BoundField DataField="ConnectionStringName" 
						HeaderText="ConnectionStringName" SortExpression="ConnectionStringName" />
					<asp:BoundField DataField="PollTime" HeaderText="PollTime" 
						SortExpression="PollTime" />
				</Columns>
				<SelectedRowStyle BackColor="SkyBlue" />
			</asp:GridView>
		</fieldset>
	</div>
</asp:Content>